﻿namespace Model
{
    public class PagedInfo<T>
    {
        public int PageSize { get; set; } = 10;


        public int PageIndex { get; set; } = 1;


        public int TotalCount { get; set; }

        public int TotalPage { get; set; }

        public List<T> Result { get; set; }

        public PagedInfo()
        {
        }

        public PagedInfo(List<T> source, int pageIndex, int pageSize)
        {
            PageIndex = pageIndex;
            PageSize = pageSize;
            TotalCount = source.Count;
            TotalPage = (int)Math.Ceiling((double)TotalCount / (double)PageSize);
        }
    }
    public class PagerInfo
    {
        private int pageSize;

        public int PageNum { get; set; }

        public int TotalNum { get; set; }

        public int TotalPageNum { get; set; }

        public int PageSize
        {
            get
            {
                return pageSize;
            }
            set
            {
                pageSize = value;
            }
        }

        public PagerInfo()
        {
            PageNum = 1;
            PageSize = 20;
        }

        public PagerInfo(int page = 1, int pageSize = 20)
        {
            PageNum = page;
            PageSize = pageSize;
        }
    }
}
